﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Lamex.Library
{
    public partial class FrmBaseDataCollection : frmBaseChild
    {
        public FrmBaseDataCollection()
        {
            if (!DesignMode)
            {
                InitializeComponent();
                new Thread(() =>
                {

                    while (true)
                    {
                        try { gc_pcTop_R.BeginInvoke(new MethodInvoker(() => gc_pcTop_R.Text = DateTime.Now.ToString() + "  " + DateTime.Now.ToString("dddd"))); }
                        catch { }
                        Thread.Sleep(1000);
                    }

                }) { IsBackground = true }.Start();
            }
        }
        private void FrmBaseDataCollection_Resize(object sender, EventArgs e)
        {
            if (!DesignMode)
            {
                SetSize_Form();
            }
        }

        private void FrmBaseDataCollection_Load(object sender, EventArgs e)
        {
            if (!DesignMode)
            {
                SetSize_Form();
            }
        }
        public void SetSize_Form()
        {
            int Ucform_W = this.Width;
            int Ucform_H = this.Height;
            //int UcpcTop_W = this.pcTop.Width;
            //int UcMid_W = this.pcMid.Width;

            //上中下Panelcontrol的尺寸
            pcTop.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(Ucform_H) / 3), 1));
            pcMid.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(Ucform_H) / 3), 1));
            pcBottom.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(Ucform_H) / 3), 1));
            //上Panelcontrol里三个panelcontrol的尺寸
            int UcpcTop_W = this.pcTop.Width;
            pcTop_L.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(UcpcTop_W) / 3), 1));
            pcTop_M.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(UcpcTop_W) / 3), 1));
            pcTop_R.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(UcpcTop_W) / 3), 1));
            //中Panelcotrol左右panel的尺寸
            int UcMid_W = this.pcMid.Width;
            pcMid_L.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(UcMid_W) / 3), 1)) * 2 + 2;
            pcMid_R.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(UcMid_W) / 3), 1)) - 3;
            //中Panelcotrol左panel里groupcontrol的尺寸
            int UcMid_W_L = this.pcMid_L.Width;
            gc_pcMid_L_1.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(UcMid_W_L) / 4), 1));
            gc_pcMid_L_2.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(UcMid_W_L) / 4), 1));
            gc_pcMid_L_3.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(UcMid_W_L) / 4), 1));
            gc_pcMid_L_4.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(UcMid_W_L) / 4), 1));
           //上Panelcontrol左四个panel尺寸
            int gc_pcTop_L_W = this.gc_pcTop_L.Width;
            pcTop_L_1.Width = 25;
            pcTop_L_3.Width = 25;
            pcTop_L_2.Width = (gc_pcTop_L_W - 50) / 3;
            pcTop_L_4.Width = (gc_pcTop_L_W - 50) / 3 * 2;
            lb_PeopleInfo.Location = new Point(Convert.ToInt32(pcTop_L_3.Width - lb_PeopleInfo.Width) / 2, Convert.ToInt32(pcTop_L_3.Height - lb_PeopleInfo.Height) / 2);
            lb_Manager1.Location = new Point(Convert.ToInt32(pcTop_L_1.Width - lb_Manager1.Width) / 2, Convert.ToInt32(pcTop_L_1.Height - lb_Manager1.Height) / 4);
            lb_Manager2.Location = new Point(Convert.ToInt32(pcTop_L_1.Width - lb_Manager2.Width) / 2, Convert.ToInt32(pcTop_L_1.Height - lb_Manager2.Height) / 4 * 3);
            //上PanelControl左Panel第二个panel两个panel的尺寸
            pcTop_L_2_1.Height=pcTop_L_2.Height/2;
            pcTop_L_2_2.Height = pcTop_L_2.Height / 2;
            lb_Name1.Location = new Point(Convert.ToInt32(pcTop_L_2_1.Width - lb_Name1.Width) / 2, Convert.ToInt32(pcTop_L_2_1.Height - lb_Name1.Height) / 2);
            lb_Name2.Location = new Point(Convert.ToInt32(pcTop_L_2_2.Width - lb_Name2.Width) / 2, Convert.ToInt32(pcTop_L_2_2.Height - lb_Name2.Height) / 2);
            //上PanelControl右panel尺寸
            //int gc_pcTop_R_H = this.pc_gc_pcTop_L.Height;
            //int pc_gc_pcTop_R_H = this.pc_gc_pcTop_R.Height;
            //int pc_gc_pcTop_R_W = this.pc_gc_pcTop_R.Width;
            //pc_gc_pcTop_L_1.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(gc_pcTop_R_H) / 4), 1));
            //pc_gc_pcTop_L_2.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(gc_pcTop_R_H) / 4), 1));
            //pc_gc_pcTop_L_3.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(gc_pcTop_R_H) / 4), 1));
            //pc_gc_pcTop_L_4.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(gc_pcTop_R_H) / 4), 1));

            //lblInfo_1.Location = new Point(2, pc_gc_pcTop_L_1.Height / 2);
            //lblInfo_2.Location = new Point(2, pc_gc_pcTop_L_2.Height / 2);
            //lblInfo_3.Location = new Point(2, pc_gc_pcTop_L_3.Height / 2);
            //lblInfo_4.Location = new Point(2, pc_gc_pcTop_L_4.Height / 2);



            //中Panelcontrol右Panel尺寸
            int pc_gcMid_H = this.pc_gcMid.Height;
            pc_gcMid_T.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(pc_gcMid_H) / 5), 1));
            pc_gcMid_B.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(pc_gcMid_H) / 5 * 4), 1));
            //int gc_pcTop_L_W = this.gc_pcTop_L.Width;
            //pcTop_L_L.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(gc_pcTop_L_W) / 2), 1));
            //pcTop_L_R.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(gc_pcTop_L_W) / 2), 1));
            //上PanelControl左Panel再左里两个panel的尺寸
            //int pcTop_L_L_W = pcTop_L_L.Width;
            //pcTop_L_L_1.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(pcTop_L_L_W) / 8), 1));
            //pcTop_L_L_2.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(pcTop_L_L_W) / 8), 1)) * 7;
            //上PanelControl左Panel再右里两个panel的尺寸
            //int pcTop_L_R_W = pcTop_L_R.Width;
            //pcTop_L_R_1.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(pcTop_L_R_W) / 8), 1));
            //pcTop_L_R_2.Width = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(pcTop_L_R_W) / 8), 1)) * 7;
            //上PanelControl左Panel两个图片的尺寸
            //int pcTop_L_L_H = this.pcTop_L_L.Height;
            //pcTop_L_lc1.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(pcTop_L_L_H) / 2), 1));
            //pcTop_L_lc2.Height = Convert.ToInt32(Math.Round(Convert.ToDouble(Convert.ToDouble(pcTop_L_L_H) / 2), 1));
        }

        private void pcTop_L_2_1_Click(object sender, EventArgs e)
        {
            picTop1.Visible = true;
            lb_Name1.Visible = false;
        }

        private void pcTop_L_2_2_Click(object sender, EventArgs e)
        {
            picTop2.Visible = true;
            lb_Name2.Visible = false;
        }

        private void picTop1_Click(object sender, EventArgs e)
        {
            picTop1.Visible = false;
            lb_Name1.Visible = true;
        }

        private void picTop2_Click(object sender, EventArgs e)
        {
            picTop2.Visible = false;
            lb_Name2.Visible = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //时间
           // gc_pcTop_R.Text = DateTime.Now.ToString() + "  " + DateTime.Now.ToString("dddd");          
        }

    }
}
